<!--#include file="Config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->

<table class="table table-condensed table-hover table-striped table-bordered">
<form name="MSmain" method="post" action='CMDB_Save.asp'>
<TR>
<Th colspan='20'>
<!--  显示相关客户 -->
<select name="CRM_ID"  style="width:100">
<option value="0" >=供应商=</option>
<%
	set rs_s = server.createobject("adodb.recordset")
	sql_s= "select * from CRM_List order by id"
	rs_s.open sql_s,conn,3
	if not rs_s.eof then
	 for i=1 to rs_s.recordcount
%>
<option value="<%=int(rs_s("id"))%>" ><%=int(rs_s("id"))%>.<%=rs_s("name")%></option>
<%
rs_s.movenext
next
end if
set rs_s=nothing
%>
</select>
<!-- 品牌:   -->
<SELECT NAME="BrandID">
<option value="0">＝品牌＝</option>
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select distinct id,name from basic_Brand order by id "
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=int(rsb("id"))%>" <% if int(session("BrandID"))=int(trim(rsb("ID"))) then response.Write("selected") %>> <%=int(rsb("id"))%>.<%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="StockType" style="width:100">
<option value="0">＝分类＝</option>
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select distinct type_id,type_name,type_fatherid from CMDB_type where type_fatherid<>0 order by type_fatherid,type_id desc"
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("type_id"))%>" <% if int(session("type_ID"))=int(trim(rsb("type_ID"))) then response.Write("selected") %>> <%=rsb("type_name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="AssetFrom">
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from CMDB_from order by id "
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("id"))%>" > <%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="AssetState">
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from CMDB_state order by id"
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("id"))%>" > <%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="UseFor" >
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from CMDB_UseForType order by id"
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("id"))%>" > <%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="Dep_ID">
<%
set rsc=Server.CreateObject("ADODB.Recordset")
rsc.open "select * from basic_company order by CompanyID",conn,1,1
for c=1 to rsc.recordcount
%>
<optgroup label="<%=trim(rsc("ComOrder"))%>.<%=trim(rsc("Company"))%>">
<%
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "select Dep_ID,Dep_name,Dep_order from emp_dep where Dep_isshow=1 and CompanyID="&int(rsc("CompanyID"))&" order by Dep_order",conn,1,1
for d=1 to rs.recordcount
%>
<option value="<%=int(rs("Dep_ID"))%>"><%=trim(rsc("ComOrder"))%>.<%=trim(rs("Dep_order"))%>.<%=trim(rs("Dep_name"))%></option><%
rs.movenext
next
rs.close


rsc.movenext
next
rsc.close

%>
</select>

<input type="submit" value="<%=session("Emp_Name")%>保存"/>
</Th>
</TR>
<!---------明细数据HTML部分开始 ----------------------------------->
<TR  >
	<TD>数量</TD>
	<TD>名称/规格</TD>
	<TD>单价</TD>
    <TD>发票号</TD>
    <TD>付款单ID</TD>
	<TD>备注</TD>
</TR>
<TR bgcolor='#FFFFFF'>
<TD>
<SELECT name="AddNum">
<%for n=1 to 30%>
<OPTION value="<%=n%>"><%=n%></OPTION>
<%next%>
</SELECT>
</TD>
<TD><INPUT TYPE="text" NAME="name" size='20'></TD>
<TD><INPUT TYPE="text" NAME="sku_price" size='8' value='0'></TD>
<TD><INPUT TYPE="text" NAME="InvoiceID" size='10'></TD>
<TD><INPUT TYPE="text" NAME="ContractID" size='10'></TD>
<TD><INPUT TYPE="text" NAME="PayID" size='10'></TD>
<TD>
<TEXTAREA NAME="info" ROWS="1" COLS="45"></TEXTAREA>
<!-- <INPUT TYPE="text" NAME="" size='40'> --></TD>
</TR>
</form>
</TABLE>
<!---------明细数据HTML部分开始 ----------------------------------->
<%
set rslist= server.createobject("adodb.recordset")
sql_list= "select top 30 * from CMDB_List where 1=1 "
sql_list=sql_list&sqlt
sql_list=sql_list&" order by SKUID desc"
rslist.open sql_list,conn,3
if pmcount="" or isempty(pmcount) or pmcount<1 then
        pmcount=30 '每页记录数
end if
rslist.pagesize=pmcount   	'设置每页数
mpage=rslist.pagecount    	'得到总页数
pageno=request("pageno")
if len(pageno)=0 or int(pageno)<1 or int(pageno)>mpage then
	pageno=1
end if
%>
<table class="table table-condensed table-hover table-striped table-bordered">
<TR>
	<Th>SKUID</Th>
	<TH>名称</TH>
	<TH>价格</TH>
	<TH>状态</TH>
	<TH>备注</TH>
	<TH>操作</TH>
</TR>
<%
if not (rslist.eof or err) then
rslist.absolutepage=pageno	'将指针移至指定页的第一条记录
loopno=pmcount
do while not (rslist.eof or err) and loopno>0
'ShowIDURL="MSMod.asp?MSNO="&rslist("MSNO")
%>
<TR >
<TD ><A HREF="CMDB_View.asp?SKUID=<%=int(Trim(rslist("SKUID")))%>" title='编辑SKU所有日志记录' target="_blank"><%=Trim(rslist("SKUID"))%></A></TD>
<TD ><A HREF="CMDB_View.asp?SKUID=<%=int(Trim(rslist("SKUID")))%>" title='编辑SKU所有日志记录' target="_blank"><%=Trim(GetCMDBType(rslist("Stocktype")))%>.<%=Trim(GetBrand(rslist("BrandID")))%>.<%=Trim(rslist("name"))%>.<%=Left(Trim(GetCRMName(rslist("CRM_ID"))),4)%></A></TD>
<TD ><B><%=FormatCurrency(rslist("sku_price"),,true)%></B>
<TD ><A HREF="CMDB_View.asp?SKUID=<%=int(Trim(rslist("SKUID")))%>" title='编辑SKU所有日志记录' target="_blank"><%=Left(GetDepName(rslist("Dep_ID")),4)%><FONT COLOR="#0099FF"><%=Trim(GetSkuUser(rslist("SKUID")))%></FONT><FONT  COLOR="#999999"><%=Trim(GetCMDBState(rslist("AssetState")))%></FONT></A></TD>
<TD  title='<%=Trim(rslist("info"))%>'><%=Left(Trim(rslist("info")),10)%>&nbsp;</TD>
<TD ><%=GetEMPName((rslist("emp_ID")))%>
<A HREF="cmdb_Edit.asp?SKUID=<%=Trim(rslist("SKUID"))%>" target="_blank">修改</A></TD>
</TR>
<%
rslist.movenext
loopno=loopno-1
loop
rslist.close
set rslist=nothing
%>
<!-- 翻页------------------------------- -->
<TR >
<Th colspan='10' >
<A HREF="?pageno=1">
[首页]</A><%IF Int(pageno)>1 then%>
<A HREF="?pageno=<%=pageno-1%>">
[上一页]</A>
<%
End if
IF Int(pageno)<Int(mpage) then
%>
<A HREF="?pageno=<%=pageno+1%>">
[下一页]</A>
<%
End if
%>
<A HREF="?pageno=<%=mpage%>">
[末页]</A>
[<%=pageno%>/<%=mpage%>]
仅显示新添加的40个记录
</Th>
</TR>
<!-- 翻页------------------------------- -->
</TABLE>
<!-- ----------结束 -->
<%
end if
%>

<!--#include file="Footer.asp" -->